package com.zretc.support.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Author jiaminxxi
 * @Date 2020-07-28 11:47:40
 */

@Entity
@Table(name = "reply")
public class Reply implements Serializable {

    private static final long serialVersionUID = 6246698142921651642L;

    /**
     * 回复编号
     */
    @Id
    @Column(name = "replyId")
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long replyId;

    /**
     * 问题编号
     */
    @ManyToOne
    @JoinColumn(name = "questionId")
    @NotFound(action = NotFoundAction.IGNORE)
    private Question question;

    /**
     * 回复归属编号
     */
    @Column(name = "parentId")
    private Long parentId;

    /**
     * 回复内容
     */
    @Column(name = "replyContent")
    private String replyContent;

    /**
     * 用户编号
     */
    @ManyToOne
    @JoinColumn(name = "userId")
    @NotFound(action = NotFoundAction.IGNORE)
    private User user;

    /**
     * 回复时间
     */
    @Column(name = "replyTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date replyTime;

    @Column(name = "replyStatus")
    private Integer replyStatus;

    public Long getReplyId() {
        return this.replyId;
    }

    public void setReplyId(Long replyId) {
        this.replyId = replyId;
    }

    public Question getQuestion() {
        return question;
    }

    public void setQuestion(Question question) {
        this.question = question;
    }

    public Long getParentId() {
        return this.parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getReplyContent() {
        return this.replyContent;
    }

    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Date getReplyTime() {
        return this.replyTime;
    }

    public void setReplyTime(Date replyTime) {
        this.replyTime = replyTime;
    }

    public Integer getReplyStatus() {
        return replyStatus;
    }

    public void setReplyStatus(Integer replyStatus) {
        this.replyStatus = replyStatus;
    }

    public Reply(Long replyId, Question question, Long parentId, String replyContent, User user, Date replyTime) {
        this.replyId = replyId;
        this.question = question;
        this.parentId = parentId;
        this.replyContent = replyContent;
        this.user = user;
        this.replyTime = replyTime;
    }

    public Reply() {
    }


}
